package java9_22.Test2;


import java.io.*;
import java.net.Socket;
import java.util.Scanner;

public class User2 {
    public static void main(String[] args) {
        Socket s=null;
        Scanner in=new Scanner(System.in);
        try {
            s=new Socket("localhost",9999);
            InputStream i = s.getInputStream();
            OutputStream o = s.getOutputStream();
            BufferedReader b=new BufferedReader(new InputStreamReader(i));
            ObjectOutputStream o1=new ObjectOutputStream(o);
            String s2 = b.readLine();
            System.out.println(s2);
            String s1 = in.next();
            int i1 = in.nextInt();
            User u=new User(s1,i1);
            o1.writeObject(u);
           String c= b.readLine();
            System.out.println(c);
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                s.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
